<!DOCTYPE html>
<html  lang="zh-CN" >
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, maximum-scale=5, viewport-fit=cover">
    <title>MC-生电服务器搭建和维护 | LO_StacNet的火柴盒</title>
    <meta name="description" content="MC-生电服务器搭建和维护本文记录了在docker中搭建我的世界基友生电服的过程，并给出相应组件的使用维护教程。">
<meta property="og:type" content="article">
<meta property="og:title" content="MC-生电服务器搭建和维护">
<meta property="og:url" content="https://lostacnet.top/post/121417/">
<meta property="og:site_name" content="LO_StacNet的火柴盒">
<meta property="og:description" content="MC-生电服务器搭建和维护本文记录了在docker中搭建我的世界基友生电服的过程，并给出相应组件的使用维护教程。">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2024-12-14T08:17:48.000Z">
<meta property="article:modified_time" content="2024-12-23T09:41:28.607Z">
<meta property="article:author" content="LO_StacNet">
<meta property="article:tag" content="MC">
<meta property="article:tag" content="docker">
<meta name="twitter:card" content="summary">

    
    <link rel="icon" href="/images/favicon.ico" type="image/x-icon">

    
<link rel="stylesheet" href="/css/common.min.css">



    
        <link href="//cdn.jsdelivr.net/npm/katex@0.9.0/dist/katex.min.css" rel="stylesheet">
    
    
    
    
        <link href="//cdn.jsdelivr.net/npm/lightgallery.js@1.1.3/dist/css/lightgallery.min.css" rel="stylesheet">
    
    
    
<link rel="stylesheet" href="/css/iconfont.min.css">

    
<meta name="generator" content="Hexo 6.3.0"><style>mjx-container[jax="SVG"] {
  direction: ltr;
}

mjx-container[jax="SVG"] > svg {
  overflow: visible;
}

mjx-container[jax="SVG"][display="true"] {
  display: block;
  text-align: center;
  margin: 1em 0;
}

mjx-container[jax="SVG"][justify="left"] {
  text-align: left;
}

mjx-container[jax="SVG"][justify="right"] {
  text-align: right;
}

g[data-mml-node="merror"] > g {
  fill: red;
  stroke: red;
}

g[data-mml-node="merror"] > rect[data-background] {
  fill: yellow;
  stroke: none;
}

g[data-mml-node="mtable"] > line[data-line] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > rect[data-frame] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > .mjx-dashed {
  stroke-dasharray: 140;
}

g[data-mml-node="mtable"] > .mjx-dotted {
  stroke-linecap: round;
  stroke-dasharray: 0,140;
}

g[data-mml-node="mtable"] > svg {
  overflow: visible;
}

[jax="SVG"] mjx-tool {
  display: inline-block;
  position: relative;
  width: 0;
  height: 0;
}

[jax="SVG"] mjx-tool > mjx-tip {
  position: absolute;
  top: 0;
  left: 0;
}

mjx-tool > mjx-tip {
  display: inline-block;
  padding: .2em;
  border: 1px solid #888;
  font-size: 70%;
  background-color: #F8F8F8;
  color: black;
  box-shadow: 2px 2px 5px #AAAAAA;
}

g[data-mml-node="maction"][data-toggle] {
  cursor: pointer;
}

mjx-status {
  display: block;
  position: fixed;
  left: 1em;
  bottom: 1em;
  min-width: 25%;
  padding: .2em .4em;
  border: 1px solid #888;
  font-size: 90%;
  background-color: #F8F8F8;
  color: black;
}

foreignObject[data-mjx-xml] {
  font-family: initial;
  line-height: normal;
  overflow: visible;
}

.MathJax path {
  stroke-width: 3;
}

mjx-container[display="true"] {
  overflow: auto hidden;
}

mjx-container[display="true"] + br {
  display: none;
}
</style></head>

    <body>
        <header class="header header-fixture">
    <div class="profile-search-wrap flex sm:block">
        
        
        <div class="profile sm:text-center md:px-1 lg:px-3 sm:pb-4 sm:pt-6">
            <a id="avatar" role="link" href="http://www.lostacnet.top" class="inline-block lg:w-16 lg:h-16 w-8 h-8 m-2" target="_blank" rel="noopener" rel="noreferrer" >
                <img src="/images/avatar.jpg" class="rounded-full" alt="avatar">
            </a>
            <h2 id="name" class="hidden lg:block">LO_StacNet</h2>
            <h3 id="title" class="hidden lg:block">电子玩家 &amp; 理想主义</h3>
            
            <small id="location" class="hidden lg:block">
                <i class="iconfont icon-map-icon"></i>
                Sichuan, China
            </small>
            
        </div>
        
        
<div class="search flex-1 flex lg:inline-block sm:hidden lg:px-4 lg:mt-2 lg:mb-4 lg:w-full">
    <form id="search-form" class="my-auto flex-1 lg:border lg:border-solid lg:border-gray-200">
        <div class="input-group table bg-gray-100 lg:bg-white w-full">
            <input id="search-input" type="text" placeholder="搜索" class="inline-block w-full bg-gray-100 lg:bg-white p-1">
            <span class="table-cell">
                <button name="search tigger button" disabled>
                    <i class="iconfont icon-search m-2"></i>
                </button>
            </span>
        </div>
    </form>
        
<div id="content-json" data-placeholder="搜索" class="invisible hidden">/content.json</div>
<script id="search-teamplate" type="text/html" data-path="/content.json">
    <div>
        <div class="search-header bg-gray-400">
            <input id="actual-search-input" model="keyword" ref="input" class="inline-block w-full h-10 px-2 py-1" placeholder="搜索" type="text">
        </div>
        <div class="search-result bg-gray-200">
            {{#each searchPosts}}
            <a href="/{{ path }}" class="result-item block px-2 pb-3 mb-1 pt-1 hover:bg-indigo-100">
                <i class="iconfont icon-file"></i>
                <h1 class="result-title inline font-medium text-lg">{{ title }}</h1>
                <p class="result-content text-gray-600 text-sm">{{{ text }}}</p>
            </a>
            {{/each}}
        </div>
    </div>
</script>

</div>


        <button name="menu toogle button" id="menu-toggle-btn" class="block sm:hidden p-3" role="button" aria-expanded="false">
            <i class="iconfont icon-hamburger"></i>
        </button>
    </div>
    <nav id="menu-nav" class="hidden sm:flex flex-col">
        
        
            <div class="menu-item menu-home" role="menuitem">
                <a href="/.">
                    <i class="iconfont icon-home" aria-hidden="true"></i>
                    <span class="menu-title">首页</span>
                </a>
            </div>
        
        
            <div class="menu-item menu-archives" role="menuitem">
                <a href="/archives">
                    <i class="iconfont icon-archive" aria-hidden="true"></i>
                    <span class="menu-title">归档</span>
                </a>
            </div>
        
        
            <div class="menu-item menu-categories" role="menuitem">
                <a href="/categories">
                    <i class="iconfont icon-folder" aria-hidden="true"></i>
                    <span class="menu-title">分类</span>
                </a>
            </div>
        
        
            <div class="menu-item menu-tags" role="menuitem">
                <a href="/tags">
                    <i class="iconfont icon-tag" aria-hidden="true"></i>
                    <span class="menu-title">标签</span>
                </a>
            </div>
        
        
            <div class="menu-item menu-links" role="menuitem">
                <a href="/links">
                    <i class="iconfont icon-friend" aria-hidden="true"></i>
                    <span class="menu-title">友链</span>
                </a>
            </div>
        
        
            <div class="menu-item menu-about" role="menuitem">
                <a href="/about">
                    <i class="iconfont icon-cup" aria-hidden="true"></i>
                    <span class="menu-title">关于</span>
                </a>
            </div>
        
        
<div class="social-links flex sm:flex-col lg:hidden mt-5">
    
        <span class="social-item text-center">
            <a target="_blank" rel="noopener" href="https://github.com/LOStacNet">
                <i class="iconfont social-icon icon-github"></i>
                <span class="menu-title hidden lg:inline">menu.github</span>
            </a>
        </span>
    
        <span class="social-item text-center">
            <a target="_blank" rel="noopener" href="https://gitee.com/LOStacNet">
                <i class="iconfont social-icon icon-project"></i>
                <span class="menu-title hidden lg:inline">menu.project</span>
            </a>
        </span>
    
</div>


    </nav>
</header>

        <section class="main-section">
            
    <main class="flex-1 px-4 py-14 md:px-5 lg:px-8 lg:py-4 relative min-h-screen">
    

    <article class="content article article-archives article-type-list" itemscope="">
        <header class="article-header">
            
    
        <h1 class="article-title text-lg" itemprop="name">
            MC-生电服务器搭建和维护
        </h1>
    



            <p class="article-meta mb-3 text-xs">
                <span class="article-date">
    <i class="iconfont icon-calendar-check"></i>
	<a href="/post/121417/" class="article-date">
	  <time datetime="2024-12-14T08:17:48.000Z" itemprop="datePublished">12月 14</time>
	</a>
</span>

                
    <span class="article-category">
    <i class="iconfont icon-folder"></i>
    <a class="article-category-link" href="/categories/Minecraft/">Minecraft</a>
  </span>


                
    <span class="article-tags">
    <i class="iconfont icon-tag"></i>
    <a class="article-tag-none-link" href="/tags/MC/" rel="tag">MC</a>, <a class="article-tag-none-link" href="/tags/docker/" rel="tag">docker</a>
  </span>


                <span class="_partial/post-comment"><i class="icon icon-comment"></i>
                    <a href="/post/121417/#comments" class="article-comment-link">
                        评论
                    </a>
                </span>
                
    
        <span class="post-wordcount" itemprop="wordCount">字数统计: 4.6k(字)</span>
    
    
        <span class="post-readcount" itemprop="timeRequired">阅读时长: 18(分)</span>
    


            </p>
        </header>
        <div class="marked-body article-body">
            <h1 id="MC-生电服务器搭建和维护"><a href="#MC-生电服务器搭建和维护" class="headerlink" title="MC-生电服务器搭建和维护"></a>MC-生电服务器搭建和维护</h1><p>本文记录了在docker中搭建我的世界基友生电服的过程，并给出相应组件的使用维护教程。</p>
<span id="more"></span>

<h2 id="环境信息"><a href="#环境信息" class="headerlink" title="环境信息"></a>环境信息</h2><ul>
<li>MC版本：1.20.1</li>
<li>jdk：openjdk:17</li>
</ul>
<h2 id="准备"><a href="#准备" class="headerlink" title="准备"></a>准备</h2><p>首先需要准备以下文件和环境：</p>
<ol>
<li>dorker，包含ubuntu镜像</li>
<li>python&gt;3.8</li>
<li>在<a target="_blank" rel="noopener" href="https://fabricmc.net/use/server/">这个网站</a>准备好.jar文件</li>
</ol>
<h2 id="容器"><a href="#容器" class="headerlink" title="容器"></a>容器</h2><h3 id="创建与删除容器"><a href="#创建与删除容器" class="headerlink" title="创建与删除容器"></a>创建与删除容器</h3><p>输入以下命令创建一个新容器并进入交互页面：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -it -u $(<span class="built_in">id</span> -u) --name MC1201 -p 25565:25565 -p 25575:25575 -v /home/lo/desktop/MC1201/server:/server ubuntu /bin/bash</span><br></pre></td></tr></table></figure>

<p>其中，<code>-it</code>指定使用交互式终端，<code>-u $(id -u)</code>使用当前用户运行容器，<code>--name MC1201</code>指定容器的名字为<code>MC1201</code>，<code>-p 25565:25565</code>将宿主机的25565(前)端口映射到容器的25565(后)，<code>-v /home/lo/desktop/MC1201/server:/server</code>将宿主机的目录(前)挂载到容器的<code>/server</code>下(必须为绝对路径)，<code>ubuntu</code>指定使用的镜像，<code>/bin/bash</code>为执行的命令，这里是启动一个终端。</p>
<p>其中26675为rcon服务预留。</p>
<p>如果不需要打开交互终端，后台运行，可以添加<code>-d</code>参数。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ docker <span class="built_in">rm</span> MC1201</span><br></pre></td></tr></table></figure>

<p>无法删除正在运行的容器。</p>
<h3 id="退出容器"><a href="#退出容器" class="headerlink" title="退出容器"></a>退出容器</h3><p>在容器中输入<code>exit</code>退出，会终止当前程序(终端)，可能导致容器停止(如果是最后一个程序的话)。</p>
<p>使用ctrl + p + q退出，不会终止容器继续运行。</p>
<p>如果使用exec命令进入bash，是新开了终端，<code>exit</code>则不会导致容器停止。</p>
<p>所以推荐使用<code>-d</code>后用exec命令进入交互。</p>
<h3 id="进入容器"><a href="#进入容器" class="headerlink" title="进入容器"></a>进入容器</h3><p>当容器正在后台运行，可以通过exec命令进入终端。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker <span class="built_in">exec</span> -it MC1201 /bin/bash</span><br></pre></td></tr></table></figure>

<p>exec命令可以在运行的容器中执行一个命令。上面的代码在容器MC1201以交互模式执行了<code>/bin/bash</code>。</p>
<p>当需要使用管理员权限执行命令，可以使用：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker <span class="built_in">exec</span> -it -u 0 MC1201 apt-get update</span><br></pre></td></tr></table></figure>

<p>由于没有使用bash，该命令执行完成后就会返回宿主机。</p>
<p>同时还可以使用以下命令进入容器：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker attach 容器ID</span><br></pre></td></tr></table></figure>

<p>attach 直接进入容器启动命令的终端(PID为1的进程)，不会启动新的进程，因此exit退出时会关闭容器(如果只有一个程序运行)，要使用ctrl + p + q。注意：使用该命令进入没有<code>-it</code>的容器终端，会无法交互。</p>
<h3 id="查看容器状态"><a href="#查看容器状态" class="headerlink" title="查看容器状态"></a>查看容器状态</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">docker ps -a <span class="comment">#查看所有容器的状态</span></span><br><span class="line">docker stats MC1201 <span class="comment">#查看名为MC1201容器状态</span></span><br></pre></td></tr></table></figure>

<p>常见状态有：</p>
<ul>
<li><strong>Up</strong>：运行中，容器正在运行，可通过stop停止</li>
<li><strong>paused</strong>：暂停，使用pause unpause命令进行控制</li>
<li><strong>exited</strong>：停止，没有运行，可以通过start/restart启动</li>
</ul>
<h3 id="启动与关闭容器"><a href="#启动与关闭容器" class="headerlink" title="启动与关闭容器"></a>启动与关闭容器</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">docker start MC1201</span><br><span class="line">docker stop MC1201</span><br></pre></td></tr></table></figure>

<h3 id="导出和导入"><a href="#导出和导入" class="headerlink" title="导出和导入"></a>导出和导入</h3><p>导出容器到文件：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker <span class="built_in">export</span> 1e560fca3906 &gt; ubuntu.tar</span><br></pre></td></tr></table></figure>

<p>1e560fca3906为容器id</p>
<p>从上面的文件导入到镜像：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cat</span> docker/ubuntu.tar | docker import - <span class="built_in">test</span>/ubuntu:v1</span><br></pre></td></tr></table></figure>

<p>该方法与镜像的save load不一样不要搞混。</p>
<h2 id="服务端"><a href="#服务端" class="headerlink" title="服务端"></a>服务端</h2><h3 id="安装运行环境"><a href="#安装运行环境" class="headerlink" title="安装运行环境"></a>安装运行环境</h3><p>依次执行以下命令：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">docker <span class="built_in">exec</span> -it -u 0 MC1201 apt-get update</span><br><span class="line">docker <span class="built_in">exec</span> -it -u 0 MC1201 apt-get install openjdk-17-jdk</span><br><span class="line">docker <span class="built_in">exec</span> -it -u 0 MC1201 apt-get install python3 python3-pip</span><br></pre></td></tr></table></figure>

<p>该命令使用<code>-u 0</code>的root用户安装软件，使用<code>-it</code>主要为了按y确认。</p>
<h3 id="试运行服务端"><a href="#试运行服务端" class="headerlink" title="试运行服务端"></a>试运行服务端</h3><p>在配置MCDR前需要先准备好服务端。</p>
<p>使用预先准备好的jar文件或者使用以下命令现下：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">curl -OJ https://meta.fabricmc.net/v2/versions/loader/1.20.1/0.16.9/1.0.1/server/jar</span><br></pre></td></tr></table></figure>

<p>然后使用以下命令运行：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">java -Xmx2G -jar fabric-server-1.20.1.jar nogui</span><br></pre></td></tr></table></figure>

<p>fabric程序会自动下载原版客户端，同时完成相关组件配置，最后启动服务器。注意eula同意。</p>
<p>如果没问题，就可以搜索到服务器进入了。</p>
<h3 id="MCDR"><a href="#MCDR" class="headerlink" title="MCDR"></a>MCDR</h3><p>首先，安装MCDR：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker <span class="built_in">exec</span> -it -u 0 MC1201 pip3 install mcdreforged</span><br></pre></td></tr></table></figure>

<p>并升级：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker <span class="built_in">exec</span> -it -u 0 MC1201 pip3 install mcdreforged -U</span><br></pre></td></tr></table></figure>

<p>然后进入容器，在一个文件夹中执行初始化命令：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mcdreforged init</span><br></pre></td></tr></table></figure>

<p>将之前的服务端移动到server文件夹中。</p>
<p>配置文件，其中最重要包括：</p>
<ol>
<li>language:语言</li>
<li>start_command:启动命令</li>
<li>handler:处理方式</li>
<li>encoding, decoding:终端语言</li>
</ol>
<p>这里先如下配置：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">language:</span> <span class="string">zh_cn</span> <span class="comment">#修改为中文</span></span><br><span class="line"><span class="attr">start_command:</span> <span class="string">java</span> <span class="string">-Xmx2G</span> <span class="string">-jar</span> <span class="string">fabric-server-1.20.1.jar</span> <span class="string">nogui</span> <span class="comment">#启动命令</span></span><br><span class="line"><span class="attr">handler:</span> <span class="string">vanilla_handler</span> <span class="comment">#默认，适合fabric</span></span><br><span class="line"><span class="attr">encoding:</span> <span class="string">utf8</span> <span class="comment">#默认，除非系统不是utf-8</span></span><br><span class="line"><span class="attr">decoding:</span> <span class="string">utf8</span> <span class="comment">#默认，除非系统不是utf-8</span></span><br></pre></td></tr></table></figure>

<p>之后，启动mcdr：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mcdreforged</span><br></pre></td></tr></table></figure>

<p>同时在游戏中也输入以下命令测试：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">!!MCDR</span><br></pre></td></tr></table></figure>

<p>之后在容器外，可以使用以下命令启动：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker exec -it -w /server MC1201 mcdreforged</span><br></pre></td></tr></table></figure>

<p><code>-w /server</code>指定了命令在server文件夹执行。</p>
<p>记得导出一个副本备份：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker <span class="built_in">export</span> MC1201 &gt; docker-export-servermc1201.tar</span><br></pre></td></tr></table></figure>

<h3 id="启动参数优化"><a href="#启动参数优化" class="headerlink" title="启动参数优化"></a>启动参数优化</h3><p>在服务端创建启动脚本start.sh</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/bin/bash</span></span><br><span class="line"></span><br><span class="line">JAR_FILE=<span class="string">'fabric-server-1.20.1.jar'</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 如果-Xmx的值大于12GB，请调整以下参数： -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15 - -XX:InitiatingHeapOccupancyPercent=20</span></span><br><span class="line">java -Xms12G -Xmx12G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=<span class="literal">true</span> -jar <span class="variable">$JAR_FILE</span> --nogui</span><br></pre></td></tr></table></figure>

<p>然后修改MCDR：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">start_command: ./start.sh</span><br></pre></td></tr></table></figure>

<h3 id="安装插件和mod"><a href="#安装插件和mod" class="headerlink" title="安装插件和mod"></a>安装插件和mod</h3><p>使用<code>!!MCDR plg</code>来处理插件，插件存放在plugins文件夹中，mod放在服务端mods中。</p>
<h3 id="管理服务器"><a href="#管理服务器" class="headerlink" title="管理服务器"></a>管理服务器</h3><p>一般来说，我们会用<code>-d</code>参数让服务器在后台运行，但对于上面的容器来说，这样就无法进入到服务器终端了，使用attach命令会进入run时创建的终端。那么想要管理服务器，有两种方法：</p>
<p><strong>使用RCON</strong></p>
<p>修改服务器server.properties文件：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">rcon.port=25575</span><br><span class="line">enable-rcon=true</span><br><span class="line">rcon.password=</span><br></pre></td></tr></table></figure>

<p>之后可以使用<a target="_blank" rel="noopener" href="https://rcon.iecraft.com/">网页端工具</a>(安全性未知)，或者客户端工具使用rcon管理原版服务端如<a target="_blank" rel="noopener" href="https://github.com/zkhssb/NectarRCON">NectarRCON</a>。</p>
<p>同时也可以顺便修改MCDR中的RCON设置。</p>
<p>如果启动容器时没有添加端口，可以重新启动，或者见以下步骤修改配置文件。</p>
<p><strong>修改docker启动命令</strong></p>
<p>先关闭docker:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">service docker stop</span><br></pre></td></tr></table></figure>

<p>首先使用命令查看容器配置文件位置：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker inspect redis|grep Id</span><br></pre></td></tr></table></figure>

<p>找到其中写明的配置路径，一般为<code>/var/lib/docker/containers/id/</code>。</p>
<p>修改端口映射文件hostconfig.json，在PortBinding添加：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">"25575/tcp":[{"HostIp":"","HostPort":"25575"}]</span><br></pre></td></tr></table></figure>

<p>修改config.v2.json中的ExposedPort:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">"ExposedPorts":{"25565/tcp":{},"25575/tcp":{}}</span><br></pre></td></tr></table></figure>

<p>然后修改config.v2.json中启动命令，找到修改：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">"Path":"/usr/local/bin/mcdreforged"</span><br><span class="line">"Cmd":["/usr/local/bin/mcdreforged"]</span><br><span class="line">"WorkingDir":"/server"</span><br></pre></td></tr></table></figure>

<p>然后重启服务：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">service docker start</span><br></pre></td></tr></table></figure>

<p>之后使用start命令就可以直接启动服务器了，同时使用attack就可以进入到服务器终端。</p>
<p>如果想在启动时进入终端，可以加上<code>-a -i</code>参数。</p>
<h2 id="配置、插件、mod与教程"><a href="#配置、插件、mod与教程" class="headerlink" title="配置、插件、mod与教程"></a>配置、插件、mod与教程</h2><h3 id="server-properties"><a href="#server-properties" class="headerlink" title="server.properties"></a>server.properties</h3><p>除了上面的RCON外，还需要注意以下几项配置：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">enforce-secure-profile=false #聊天的身份签名，需要关闭</span><br><span class="line">motd=\u00A7eLO的服务器\u00A7r\n\u00A7b1.20.1全面升级 # 服务器标语</span><br><span class="line">pvp=true</span><br><span class="line">difficulty=hard #修改为困难</span><br><span class="line">max-players=10 # 10人足以</span><br><span class="line">allow-flight=true # 防止意外退出</span><br><span class="line">view-distance=10</span><br><span class="line">prevent-proxy-connections=false # 允许虚拟网络代理</span><br><span class="line">entity-broadcast-range-percentage=100 #实体渲染百分比，在视距百分之距离内的实体被渲染</span><br><span class="line">simulation-distance=10 # 玩家多少区块内实体可更新</span><br><span class="line">white-list=true # 白名单启用</span><br><span class="line">enforce-whitelist=true # 强制白名单，白名单更新后不在名单的玩家是否踢出</span><br><span class="line">spawn-protection=0 # 出生点保护</span><br></pre></td></tr></table></figure>

<h3 id="MCDR-1"><a href="#MCDR-1" class="headerlink" title="MCDR"></a>MCDR</h3><p><a target="_blank" rel="noopener" href="https://docs.mcdreforged.com/zh-cn/latest/">文档地址</a></p>
<p>这里列出常见管理命令。</p>
<p><strong>权限</strong></p>
<p>MCDR 中一共有 5 种不同的权限等级：</p>
<table>
<thead>
<tr>
<th>名称</th>
<th>整数值</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td>owner</td>
<td>4</td>
<td>最高权限，所有者，具有控制物理服务器的能力。例子：控制台</td>
</tr>
<tr>
<td>admin</td>
<td>3</td>
<td>管理员，拥有控制 MCDR 与 Minecraft 服务器的能力。例子：Minecraft 中的 OP</td>
</tr>
<tr>
<td>helper</td>
<td>2</td>
<td>助手，可以协助管理员进行服务器管理。例子：值得信赖的成员</td>
</tr>
<tr>
<td>user</td>
<td>1</td>
<td>普通玩家</td>
</tr>
<tr>
<td>guest</td>
<td>0</td>
<td>最低权限，如访客或者熊孩子</td>
</tr>
</tbody></table>
<p>权限文件 <code>permission.yml</code> 用以储存权限系统的相关信息，使用 <code>!!MCDR reload permission</code> 命令来重载权限文件。</p>
<p><strong>帮助</strong></p>
<p><code>!!help</code> 命令将显示所有命令的帮助消息，此命令的内容可以由插件注册。</p>
<p><strong>!!MCDR命令</strong></p>
<p><code>!!MCDR</code> 命令是用户在控制台或游戏中控制 MCDR 的方式。这些命令至少需要权限级别 3 (admin) 才能执行，会看到 MCDR 命令的帮助消息，否则只有版本信息。</p>
<p>比较重要的命令如下：</p>
<p><code>!!MCDR reload</code> 子命令可以热重载，缩写为 <code>!!MCDR r</code>。</p>
<p><code>!!MCDR permission</code> 子命令用于操作玩家权限。它的缩写是 <code>!!MCDR perm</code>。</p>
<p><code>!!MCDR plugin</code> 用于操纵插件的命令。它的缩写是 <code>!!MCDR plg</code>。</p>
<p><code>!!MCDR server</code> 子命令可用于控制被守护的服务端。</p>
<p><strong>配置</strong></p>
<p>MCDR 的配置文件是 <code>config.yml</code>，可以使用 <code>!!MCDR reload config</code> 命令（或其缩写 <code>!!MCDR r cfg</code>）来重载配置文件。</p>
<p>常见配置项：</p>
<ul>
<li>language-设置为zh_cn</li>
<li>rcon-设置为相应的</li>
<li>plugin_download_url-下载链接，可以修改为<code>https://mirror.ghproxy.com/{url}</code>进行加速</li>
</ul>
<h3 id="MCDR-Prime-Backup"><a href="#MCDR-Prime-Backup" class="headerlink" title="MCDR-Prime Backup"></a>MCDR-Prime Backup</h3><p><a target="_blank" rel="noopener" href="https://mcdreforged.com/zh-CN/plugin/prime_backup">插件主页</a></p>
<p>依赖部分python包:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip3 install -r https://tisunion.github.io/PrimeBackup/requirements.txt</span><br></pre></td></tr></table></figure>

<p><strong>配置</strong></p>
<p>在<code>config/prime_backup/config.json</code>中：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">// 根配置</span><br><span class="line">{</span><br><span class="line">    // ...</span><br><span class="line">    "backup": {</span><br><span class="line">        "targets": [</span><br><span class="line">            "world"</span><br><span class="line">        ],</span><br><span class="line">    }</span><br><span class="line">    // ...</span><br><span class="line">}</span><br></pre></td></tr></table></figure>

<p>设置备份目标。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">// 根配置</span><br><span class="line">{</span><br><span class="line">    // ...</span><br><span class="line">    "backup": {</span><br><span class="line">        "hash_method": "xxh128",</span><br><span class="line">        "compress_method": "zstd",</span><br><span class="line">    }</span><br><span class="line">    // ...</span><br><span class="line">}</span><br></pre></td></tr></table></figure>

<p>推荐使用”xxh128”,”zstd”。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">// root config</span><br><span class="line">{</span><br><span class="line">    "enabled": true</span><br><span class="line">    // ...</span><br><span class="line">}</span><br></pre></td></tr></table></figure>

<p>修改为true启用。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line">{</span><br><span class="line">    "prefix": "!!pb",</span><br><span class="line">    "permission": {</span><br><span class="line">        "root": 1,</span><br><span class="line">        "abort": 1,  </span><br><span class="line">        "back": 2,</span><br><span class="line">        "confirm": 1,</span><br><span class="line">        "database": 4,</span><br><span class="line">        "delete": 3,</span><br><span class="line">        "delete_range": 3,</span><br><span class="line">        "export": 4,</span><br><span class="line">        "list": 1,</span><br><span class="line">        "make": 1,</span><br><span class="line">        "prune": 2,</span><br><span class="line">        "rename": 1,</span><br><span class="line">        "show": 1,</span><br><span class="line">        "tag": 2</span><br><span class="line">    },</span><br><span class="line">    "confirm_time_wait": "1m",</span><br><span class="line">    "backup_on_restore": true,</span><br><span class="line">    "restore_countdown_sec": 10</span><br><span class="line">}</span><br></pre></td></tr></table></figure>

<p>permission-所有子命令所需的 MCDR 权限等级 的最低权限级别。</p>
<p>backup_on_restore-是否进行回档前临时备份</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">{</span><br><span class="line">    "enabled": true,</span><br><span class="line">    "interval": "24h",</span><br><span class="line">    "crontab": null,</span><br><span class="line">    "jitter": "10s",</span><br><span class="line">    "reset_timer_on_backup": true,</span><br><span class="line">    "require_online_players": false,</span><br><span class="line">    "require_online_players_blacklist": []</span><br><span class="line">}</span><br></pre></td></tr></table></figure>

<p>定时备份配置：</p>
<p>interval-时间间隔</p>
<p>reset_timer_on_backup-手动备份则重置计时</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">{</span><br><span class="line">    "enabled": true,</span><br><span class="line">    "interval": "12h",</span><br><span class="line">    "crontab": null,</span><br><span class="line">    "jitter": "20s",</span><br><span class="line">    "timezone_override": null,</span><br><span class="line">    "regular_backup": {</span><br><span class="line">        "enabled": true,</span><br><span class="line">        "max_amount": 3,</span><br><span class="line">        "max_lifetime": "0s",</span><br><span class="line">        "last": -1,</span><br><span class="line">        "hour": 0,</span><br><span class="line">        "day": 0,</span><br><span class="line">        "week": 0,</span><br><span class="line">        "month": 0,</span><br><span class="line">        "year": 0</span><br><span class="line">    },</span><br><span class="line">    "temprory_backup": {</span><br><span class="line">        "enabled": true,</span><br><span class="line">        "max_amount": 5,</span><br><span class="line">        "max_lifetime": "7d",</span><br><span class="line">        "last": -1,</span><br><span class="line">        "hour": 0,</span><br><span class="line">        "day": 0,</span><br><span class="line">        "week": 0,</span><br><span class="line">        "month": 0,</span><br><span class="line">        "year": 0</span><br><span class="line">    }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>

<p>备份清理功能配置：</p>
<ul>
<li><code>regular_backup</code>: 针对常规备份，即非临时备份</li>
<li><code>temporary_backup</code>: 针对临时备份，如回档前的备份</li>
</ul>
<p>max_amount-定义要保留的最大备份数量，例如 <code>10</code> 表示最多保留最新的 10 个备份</p>
<p>max_lifetime-所有备份的最大保存时长。超出给定时长的备份将被清理，0s为无限制</p>
<p>其余可以看<a target="_blank" rel="noopener" href="https://www.cnblogs.com/varden/p/15251582.html">这里</a></p>
<p><strong>命令</strong></p>
<p>在 MCDR 控制台或游戏中输入 <code>!!pb</code>。</p>
<h3 id="MCDR-Seed"><a href="#MCDR-Seed" class="headerlink" title="MCDR-Seed"></a>MCDR-Seed</h3><p><a target="_blank" rel="noopener" href="https://mcdreforged.com/zh-CN/plugin/seed">插件主页</a></p>
<p>!!seed指令获取服务器种子，无需手动在配置文件中指定种子，插件可以自动获取。</p>
<h3 id="MCDR-Loaction-Maker"><a href="#MCDR-Loaction-Maker" class="headerlink" title="MCDR-Loaction Maker"></a>MCDR-Loaction Maker</h3><p><a target="_blank" rel="noopener" href="https://mcdreforged.com/zh-CN/plugin/location_marker">插件主页</a>-依赖于这个<a target="_blank" rel="noopener" href="https://mcdreforged.com/zh-CN/plugin/minecraft_data_api">插件</a></p>
<p>一个服务端共享路标点管理器。</p>
<p><strong>配置文件</strong></p>
<p>Marker data file path: <code>config/location_marker/locations.json</code></p>
<p>Marker config file path: <code>config/location_marker/config.json</code></p>
<h3 id="MCDR-Here"><a href="#MCDR-Here" class="headerlink" title="MCDR-Here"></a>MCDR-Here</h3><p><a target="_blank" rel="noopener" href="https://mcdreforged.com/zh-CN/plugin/here">插件主页</a></p>
<p>使用<code>!!here</code>来显示玩家坐标并发光。</p>
<p><strong>配置文件</strong></p>
<p> <code>config/here.json</code>中：</p>
<p><code>highlight_time</code>：整数，控制玩家是否高亮和时间(0为不高亮)；</p>
<p><code>display_voxel_waypoint</code>：布尔值，为真则显示一小段文本（<code>[+V]</code>），点击以高亮坐标，Ctrl+点击以添加坐标点至 <a target="_blank" rel="noopener" href="https://www.curseforge.com/minecraft/mc-mods/voxelmap">Voxelmap</a>；</p>
<p><code>display_xaero_waypoint</code>：布尔值，为真则显示一小段文本（<code>[+X]</code>），点击以添加坐标点至 <a target="_blank" rel="noopener" href="https://chocolateminecraft.com/minimap2.php">Xaero’s Minimap</a>；</p>
<h3 id="MCDR-allow-suicide"><a href="#MCDR-allow-suicide" class="headerlink" title="MCDR-allow_suicide"></a>MCDR-allow_suicide</h3><p><a target="_blank" rel="noopener" href="https://mcdreforged.com/zh-CN/plugin/allow_suicide">插件主页</a></p>
<p>允许没有op权限的玩家自杀</p>
<h3 id="MCDR-Crash-Restart"><a href="#MCDR-Crash-Restart" class="headerlink" title="MCDR-Crash Restart"></a>MCDR-Crash Restart</h3><p><a target="_blank" rel="noopener" href="https://mcdreforged.com/zh-CN/plugin/crash_restart">插件主页</a></p>
<p>一个简单的在服务端崩溃后自动重启服务器的插件</p>
<p>在服务端崩溃太频繁时将会停止重启。默认情况下最大容忍度为 5 分钟内 3 次崩溃。</p>
<h3 id="MCDR-Showlt"><a href="#MCDR-Showlt" class="headerlink" title="MCDR-Showlt"></a>MCDR-Showlt</h3><p><a target="_blank" rel="noopener" href="https://mcdreforged.com/zh-CN/plugin/showshowway/introduction">插件主页</a></p>
<p>允许获得玩家的头或者展示手上物品。</p>
<p>获得头：<code>!!skull &lt;player&gt;</code></p>
<p>展示物品：<code>!!show</code></p>
<hr>
<h3 id="MOD-Fabric-API"><a href="#MOD-Fabric-API" class="headerlink" title="MOD-Fabric API"></a>MOD-Fabric API</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/3124.html">模组地址</a>——服务端、客户端</p>
<p>Fabric API是Fabric的组成之一，包含了很多MOD开发中用到的API，方便MOD开发者。它与MOD加载器分开可能是官方对于轻量化的考虑。</p>
<p>该mod无需配置，直接丢进mods即可，是很多mod的前置。</p>
<h3 id="MOD-Easy-Auth"><a href="#MOD-Easy-Auth" class="headerlink" title="MOD-Easy Auth"></a>MOD-Easy Auth</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/6241.html">模组地址</a>——服务端</p>
<p>前置mod:Fabric API</p>
<p>一个运行在Fabric端的登录模组，提供玩家账号功能，使离线模式服务器更为安全。同时还支持正版用户自动登录。</p>
<p><strong>玩家命令</strong></p>
<ul>
<li><code>/login &lt;password&gt;, /l &lt;password&gt;</code> - 登陆账号</li>
<li><code>/logout </code>- 退出登陆</li>
<li><code>/register &lt;password&gt; &lt;password&gt; </code>- 注册账号</li>
<li><code>/account</code> - 管理账号</li>
<li><code>/unregister &lt;password&gt;</code> - 注销账号</li>
<li><code>/changePassword &lt;old password&gt; &lt;new password&gt;</code> - 更改密码</li>
</ul>
<p><strong>管理员命令</strong></p>
<ul>
<li><code>/auth reload</code> - 重新配置文件</li>
<li><code>/auth setGlobalPassword &lt;password&gt;</code> - 为服务器设置一个全局密码</li>
<li><code>/auth setSpawn [&lt;dimension id&gt; &lt;x&gt; &lt;y&gt; &lt;z&gt;] </code>- 设置一个出生点在玩家登录过程中将他们临时传送至此</li>
<li><code>/auth remove &lt;uuid&gt;</code> - 将用户数据从数据库中删除</li>
<li><code>/auth update &lt;uuid&gt; &lt;password&gt;</code> -更新用户密码</li>
<li><code>/auth register &lt;uuid&gt; &lt;password&gt;</code> - 注册一个新用户</li>
<li><code>/auth uuid &lt;player&gt;</code> - 以小写形式输入玩家昵称将给出该昵称的离线 uuid</li>
<li><code>/auth addToForcedOffline &lt;player&gt;</code> - 将玩家添加至强制离线列表</li>
<li><code>/auth list</code> - 列出所有已注册玩家</li>
</ul>
<p><strong>使用正版验证</strong></p>
<ol>
<li>在server.properties中将<code>online-mode</code>更改为true，开启正版验证</li>
<li>在EasyAuth的配置文件(<code>mods/EasyAuth/main.conf</code>)中将<code>premiumAutologin</code>设置为true</li>
<li>正版玩家将拥有正版uuid</li>
<li>通过强制离线列表让某正版账户用户名使用离线uuid方式认证(在和正版用户重名时使用)</li>
</ol>
<p><strong>其他配置</strong></p>
<p><code>maxLoginTries</code>-设置为3</p>
<p><code>spawnOnJoin</code>-设置为true让登录时传送到某一位置</p>
<h3 id="MOD-Skin-Restorer"><a href="#MOD-Skin-Restorer" class="headerlink" title="MOD-Skin Restorer"></a>MOD-Skin Restorer</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/6867.html">模组地址</a>——服务端</p>
<p>让玩家可以自定义皮肤，也可以正常显示正版玩家的皮肤。</p>
<p>使用方法：</p>
<ul>
<li>正版皮肤：<code>/skin set mojang &lt;username&gt; [&lt;targets&gt;]</code>-<username>为玩家名，target可选(默认自己)</username></li>
<li>ely.by皮肤：<code>/skin set ely.by &lt;username&gt; [&lt;targets&gt;]</code>-使用Ely.by网站的皮肤</li>
<li>网页皮肤：<code>/skin set web (classic|slim) "&lt;url&gt;" [&lt;targets&gt;]</code>-使用<url>的皮肤文件，classic|slim选择粗还是细皮肤</url></li>
<li>刷新皮肤：<code>/skin refresh [&lt;targets&gt;]</code></li>
<li>清除皮肤：<code>/skin clear [&lt;targets&gt;]</code></li>
<li>重置皮肤(变回默认)：<code>/skin reset [&lt;targets&gt;]</code></li>
</ul>
<p><strong>配置文件</strong></p>
<ul>
<li>language-设置为zh_cn</li>
</ul>
<p>由于其最新的2.2.0版本存在阻止服务端退出的bug，请使用2.2.1版本。</p>
<h3 id="MOD-Easy-WhiteList"><a href="#MOD-Easy-WhiteList" class="headerlink" title="MOD-Easy WhiteList"></a>MOD-Easy WhiteList</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/9265.html">模组地址</a>——服务端</p>
<p>一个简单的mod，将白名单、封禁、op列表从基于UUID修改为基于用户名，方便离线玩家的可变UUID，解决添加白名单后依然不在白名单的问题。</p>
<p><strong>命令</strong></p>
<ul>
<li><code>/easywhitelist add &lt;username&gt;</code></li>
<li><code>/easywhitelist remove &lt;username&gt;</code></li>
<li><code>/easyban &lt;username&gt;</code></li>
<li><code>/easyop &lt;username&gt;</code></li>
<li><code>/easydeop &lt;username&gt;</code></li>
</ul>
<p><strong>配置文件</strong></p>
<p><code>whitelist.json</code> <code>ops.json</code> <code>banned-players.json</code> 中依然包含用户名和UUID，但UUID不会被使用(格式要对)</p>
<h3 id="MOD-Servux"><a href="#MOD-Servux" class="headerlink" title="MOD-Servux"></a>MOD-Servux</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/5219.html">模组地址</a>——服务端</p>
<p>用于给MiniHUD发送结构边界框，配合客户端MiniHUD模组使用。</p>
<h3 id="MOD-Syncmatica"><a href="#MOD-Syncmatica" class="headerlink" title="MOD-Syncmatica"></a>MOD-Syncmatica</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/6842.html">模组地址</a>——服务端、客户端</p>
<p> 前置mod：Litematica(投影)、[MaLiLib]Masa’s Litemod (服务器不需要)</p>
<p>共享原理图mod，实现服务器原理图共享。</p>
<p><strong>使用方法</strong></p>
<p>客户端在已经加载的原理图列表按下Shift并点击Share即可上传到服务器。</p>
<p>其他玩家打开View Syncmatica点击Download即可加载，用Unload删除。</p>
<p><strong>配置文件</strong></p>
<p>需要注意的是<code>config/syncmatic/config.json</code>中<code>quota</code>决定了是否开启原理图的大小限制，单位为字节。</p>
<h3 id="MOD-Carpet"><a href="#MOD-Carpet" class="headerlink" title="MOD-Carpet"></a>MOD-Carpet</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/2361.html">模组地址</a>——服务端</p>
<p>大名鼎鼎的地毯mod。</p>
<p><strong>常用命令</strong></p>
<p>网上教程很多这里不再赘述，这里给出几个重要的。</p>
<p><code>/carpet</code>列出所有功能</p>
<p><code>/carpet &lt;function name&gt; [&lt;value&gt;]</code>设置某项功能的值</p>
<p><code>/carpet setDefault/removeDefault &lt;function name&gt; [&lt;value&gt;]</code>同上，但永久设置</p>
<p><code>/carpet list &lt;query&gt;</code>根据query查找功能</p>
<p><strong>配置文件</strong></p>
<p><code>/carpet carpetCommandPermissionLevel [&lt;value&gt;]</code>-设置命令需要的权限级别如默认的ops</p>
<p><strong>修改配置选项</strong></p>
<ul>
<li><code>language</code>-设置为zh_cn设置为中文</li>
<li><code>commandPlayer</code>-设为true让所有人都可以召唤假人(默认只有ops)</li>
<li><code>ctrlQCraftingFix</code>-设置为true让工作台合成格可以Ctrl+Q合成丢出物品</li>
<li><code>flippinCactus</code>-设置为true让玩家能用仙人掌翻转方块</li>
<li><code>lagFreeSpawning</code>-设置为true减少刷怪需要的CPU和内存</li>
<li><code>xpNoCooldown</code>-设置为true让玩家吸收经验球没有冷却</li>
</ul>
<h3 id="MOD-Carpet-Extra-Carpet扩展-暂不加"><a href="#MOD-Carpet-Extra-Carpet扩展-暂不加" class="headerlink" title="MOD-Carpet Extra-Carpet扩展(暂不加)"></a>MOD-Carpet Extra-Carpet扩展(暂不加)</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/3325.html">模组地址</a>——服务端</p>
<p>前置：Carpet</p>
<p>地毯扩展，添加了一些其他的规则特性。</p>
<p><strong>修改配置选项</strong></p>
<p><code>accurateBlockPlacement</code>-修改为true使能方块精准放置功能</p>
<h3 id="MOD-CarpetTISAdditon-Carpet扩展"><a href="#MOD-CarpetTISAdditon-Carpet扩展" class="headerlink" title="MOD-CarpetTISAdditon-Carpet扩展"></a>MOD-CarpetTISAdditon-Carpet扩展</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/5664.html">模组地址</a>——服务端</p>
<p>扩展，主要添加了其他规则特性。</p>
<p><strong>修改配置选项</strong></p>
<p><code>fakePlayerNamePrefix</code>-设置为#none不添加前缀，设置为bot_</p>
<p><code>farmlandTrampledDisabled</code>-设置为true禁止耕地被踩坏</p>
<p><code>turtleEggTrampledDisabled</code>-设置为true禁止海龟蛋被踩坏</p>
<h3 id="MOD-GugleCarpetAddition-Carpet扩展"><a href="#MOD-GugleCarpetAddition-Carpet扩展" class="headerlink" title="MOD-GugleCarpetAddition-Carpet扩展"></a>MOD-GugleCarpetAddition-Carpet扩展</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/7305.html">模组地址</a>——服务端</p>
<p>扩展，主要添加了可以打开假人背包。</p>
<p><strong>修改配置选项</strong></p>
<p><code>openFakePlayerInventory</code>-设为true允许打卡假人背包</p>
<p><code>fakePlayerAutoReplenishment</code>-设置为true允许假人自动补货</p>
<p><code>fakePlayerAutoReplaceTool</code>-设置为true允许假人自动替换工具</p>
<p><code>fakePlayerAutoFish</code>-设置为true允许假人自动钓鱼</p>
<h3 id="MOD-PCA-Plusls-Carpet-Addition-Carpet扩展-弃用"><a href="#MOD-PCA-Plusls-Carpet-Addition-Carpet扩展-弃用" class="headerlink" title="MOD-[PCA]Plusls Carpet Addition-Carpet扩展(弃用)"></a>MOD-[PCA]Plusls Carpet Addition-Carpet扩展(弃用)</h3><p><a target="_blank" rel="noopener" href="https://www.mcmod.cn/class/4197.html">模组地址</a>——服务端、客户端</p>
<p>前置：Carpet、MagicLib</p>
<p>主要添加了PCA同步协议，供客户端的一些mod如Tweakeroo,Masa Gadget,BBOR等来显示一些信息。</p>
<p><strong>修改配置选项</strong></p>
<p><code>pcaSyncProtocol</code>-设置为true开启PCA，目前被Masa Gadget用于实现多人游戏容器预览。</p>
<p><code>pcaSyncPlayerEntity</code>-设置为ops_and_self修改同步权限</p>
<p><code>quickLeafDecay</code>-设置为true开启树叶快速腐烂</p>
<ul>
<li><strong>更新</strong>：使用<a target="_blank" rel="noopener" href="https://github.com/Fallen-Breath/pca-protocol/releases">pca-protocal</a>代替，只实现PCA并且不需要前置。</li>
</ul>
<h2 id="问题汇总"><a href="#问题汇总" class="headerlink" title="问题汇总"></a>问题汇总</h2><h3 id="无法pull镜像"><a href="#无法pull镜像" class="headerlink" title="无法pull镜像"></a>无法pull镜像</h3><p>如果无法pull，可以使用离线的镜像save包，如准备的<code>docker-openjdk17.tar</code>文件，输入以下命令从离线文件中导入：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker load -i docker-openjdk17.tar</span><br></pre></td></tr></table></figure>



<h2 id="参考资料"><a href="#参考资料" class="headerlink" title="参考资料"></a>参考资料</h2><p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/BOXonline1396529/p/18503460">Minecraft 1.21.1游戏服务器运维笔记</a> </p>
<p><a target="_blank" rel="noopener" href="https://mcversions.net/">MC全版本文件下载</a> </p>
<p><a target="_blank" rel="noopener" href="https://www.runoob.com/docker">docker教程</a> </p>
<p><a target="_blank" rel="noopener" href="https://mcdreforged.com/">MCDReforged</a> </p>
<p><a target="_blank" rel="noopener" href="https://docs.mcdreforged.com/zh-cn/latest/docker.html">MCDR的docker</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/jamesdodo/article/details/106770830">追加端口映射</a> </p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/tianlangstudio/article/details/113571673">暴力修改Docker容器的启动命令</a> </p>

        </div>
        
<blockquote class="copyright">
    <p><strong>本文链接 : </strong><a class="permalink" href="https://lostacnet.top/post/121417/">https://lostacnet.top/post/121417/</a></p>
    <p><strong>This article is available under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" rel="noopener noreferrer">Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)</a> License  转载请注明出处</strong></p>
</blockquote>


    </article>
    
    <section id="comments">
        
    </section>


    

</main>


<aside style="" id="sidebar" class="aside aside-fixture">
    <div class="toc-sidebar">
        <nav id="toc" class="article-toc">
            <h3 class="toc-title">文章目录</h3>
            <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#MC-%E7%94%9F%E7%94%B5%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA%E5%92%8C%E7%BB%B4%E6%8A%A4"><span class="toc-number">1.</span> <span class="toc-text">MC-生电服务器搭建和维护</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%8E%AF%E5%A2%83%E4%BF%A1%E6%81%AF"><span class="toc-number">1.1.</span> <span class="toc-text">环境信息</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%87%86%E5%A4%87"><span class="toc-number">1.2.</span> <span class="toc-text">准备</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%B9%E5%99%A8"><span class="toc-number">1.3.</span> <span class="toc-text">容器</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E4%B8%8E%E5%88%A0%E9%99%A4%E5%AE%B9%E5%99%A8"><span class="toc-number">1.3.1.</span> <span class="toc-text">创建与删除容器</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%80%80%E5%87%BA%E5%AE%B9%E5%99%A8"><span class="toc-number">1.3.2.</span> <span class="toc-text">退出容器</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BF%9B%E5%85%A5%E5%AE%B9%E5%99%A8"><span class="toc-number">1.3.3.</span> <span class="toc-text">进入容器</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B%E5%AE%B9%E5%99%A8%E7%8A%B6%E6%80%81"><span class="toc-number">1.3.4.</span> <span class="toc-text">查看容器状态</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%90%AF%E5%8A%A8%E4%B8%8E%E5%85%B3%E9%97%AD%E5%AE%B9%E5%99%A8"><span class="toc-number">1.3.5.</span> <span class="toc-text">启动与关闭容器</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AF%BC%E5%87%BA%E5%92%8C%E5%AF%BC%E5%85%A5"><span class="toc-number">1.3.6.</span> <span class="toc-text">导出和导入</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E7%AB%AF"><span class="toc-number">1.4.</span> <span class="toc-text">服务端</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E8%BF%90%E8%A1%8C%E7%8E%AF%E5%A2%83"><span class="toc-number">1.4.1.</span> <span class="toc-text">安装运行环境</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%AF%95%E8%BF%90%E8%A1%8C%E6%9C%8D%E5%8A%A1%E7%AB%AF"><span class="toc-number">1.4.2.</span> <span class="toc-text">试运行服务端</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MCDR"><span class="toc-number">1.4.3.</span> <span class="toc-text">MCDR</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%90%AF%E5%8A%A8%E5%8F%82%E6%95%B0%E4%BC%98%E5%8C%96"><span class="toc-number">1.4.4.</span> <span class="toc-text">启动参数优化</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E6%8F%92%E4%BB%B6%E5%92%8Cmod"><span class="toc-number">1.4.5.</span> <span class="toc-text">安装插件和mod</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8"><span class="toc-number">1.4.6.</span> <span class="toc-text">管理服务器</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E3%80%81%E6%8F%92%E4%BB%B6%E3%80%81mod%E4%B8%8E%E6%95%99%E7%A8%8B"><span class="toc-number">1.5.</span> <span class="toc-text">配置、插件、mod与教程</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#server-properties"><span class="toc-number">1.5.1.</span> <span class="toc-text">server.properties</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MCDR-1"><span class="toc-number">1.5.2.</span> <span class="toc-text">MCDR</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MCDR-Prime-Backup"><span class="toc-number">1.5.3.</span> <span class="toc-text">MCDR-Prime Backup</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MCDR-Seed"><span class="toc-number">1.5.4.</span> <span class="toc-text">MCDR-Seed</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MCDR-Loaction-Maker"><span class="toc-number">1.5.5.</span> <span class="toc-text">MCDR-Loaction Maker</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MCDR-Here"><span class="toc-number">1.5.6.</span> <span class="toc-text">MCDR-Here</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MCDR-allow-suicide"><span class="toc-number">1.5.7.</span> <span class="toc-text">MCDR-allow_suicide</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MCDR-Crash-Restart"><span class="toc-number">1.5.8.</span> <span class="toc-text">MCDR-Crash Restart</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MCDR-Showlt"><span class="toc-number">1.5.9.</span> <span class="toc-text">MCDR-Showlt</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-Fabric-API"><span class="toc-number">1.5.10.</span> <span class="toc-text">MOD-Fabric API</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-Easy-Auth"><span class="toc-number">1.5.11.</span> <span class="toc-text">MOD-Easy Auth</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-Skin-Restorer"><span class="toc-number">1.5.12.</span> <span class="toc-text">MOD-Skin Restorer</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-Easy-WhiteList"><span class="toc-number">1.5.13.</span> <span class="toc-text">MOD-Easy WhiteList</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-Servux"><span class="toc-number">1.5.14.</span> <span class="toc-text">MOD-Servux</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-Syncmatica"><span class="toc-number">1.5.15.</span> <span class="toc-text">MOD-Syncmatica</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-Carpet"><span class="toc-number">1.5.16.</span> <span class="toc-text">MOD-Carpet</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-Carpet-Extra-Carpet%E6%89%A9%E5%B1%95-%E6%9A%82%E4%B8%8D%E5%8A%A0"><span class="toc-number">1.5.17.</span> <span class="toc-text">MOD-Carpet Extra-Carpet扩展(暂不加)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-CarpetTISAdditon-Carpet%E6%89%A9%E5%B1%95"><span class="toc-number">1.5.18.</span> <span class="toc-text">MOD-CarpetTISAdditon-Carpet扩展</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-GugleCarpetAddition-Carpet%E6%89%A9%E5%B1%95"><span class="toc-number">1.5.19.</span> <span class="toc-text">MOD-GugleCarpetAddition-Carpet扩展</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MOD-PCA-Plusls-Carpet-Addition-Carpet%E6%89%A9%E5%B1%95-%E5%BC%83%E7%94%A8"><span class="toc-number">1.5.20.</span> <span class="toc-text">MOD-[PCA]Plusls Carpet Addition-Carpet扩展(弃用)</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%97%AE%E9%A2%98%E6%B1%87%E6%80%BB"><span class="toc-number">1.6.</span> <span class="toc-text">问题汇总</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%97%A0%E6%B3%95pull%E9%95%9C%E5%83%8F"><span class="toc-number">1.6.1.</span> <span class="toc-text">无法pull镜像</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99"><span class="toc-number">1.7.</span> <span class="toc-text">参考资料</span></a></li></ol></li></ol>
        </nav>
    </div>
</aside>





        </section>
        <footer class="hidden lg:block fixed bottom-0 left-0 sm:w-1/12 lg:w-1/6 bg-gray-100 z-40">
    
    <div class="footer-social-links">
        
            <a target="_blank" rel="noopener" href="https://github.com/LOStacNet">
                <i class="iconfont icon-github"></i>
            </a>
        
            <a target="_blank" rel="noopener" href="https://gitee.com/LOStacNet">
                <i class="iconfont icon-project"></i>
            </a>
        
    </div>
    
    
</footer>

        <div id="mask" class="hidden mask fixed inset-0 bg-gray-900 opacity-75 z-40"></div>
        <div id="search-view-container" class="hidden shadow-xl"></div>
        
<script src="/js/dom-event.min.js"></script>



<script src="/js/local-search.min.js"></script>



    <script src="//cdn.jsdelivr.net/npm/lightgallery.js@1.1.3/dist/js/lightgallery.min.js"></script>
    
<script src="/js/light-gallery.min.js"></script>






    </body>
</html>
